package com.fzkjjt.mybatisplus.controller;

import com.fzkjjt.mybatisplus.mapper.UserMapper;
import com.fzkjjt.mybatisplus.pojo.User;
import com.fzkjjt.mybatisplus.vo.UserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: mybatis-plus
 * @description:
 * @author: FangZhen
 * @create: 2020-08-28 15:54
 **/
@RestController
@RequestMapping("/user")
@Api(tags = {"用户的api"})
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @GetMapping("/get")
    @ApiOperation("用户请求查询接口")
    public UserVO get() {
        User user = userMapper.selectById(6L);
        UserVO userVO = new UserVO();
        BeanUtils.copyProperties(user, userVO);
        return userVO;
    }
}
